Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup error handlers: round 4 #119171

Merged
merged 22 commits into from
Dec 23, 2023
Merged

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Dec 20, 2023

More rustc_errors cleanups. A sequel to #118933.

r? @compiler-errors

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 20, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 20, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

Some changes occurred in need_type_info.rs

cc @lcnr

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

@nnethercote nnethercote marked this pull request as draft December 20, 2023 22:25
@bors
Copy link
Contributor

bors commented Dec 22, 2023

☔ The latest upstream changes (presumably #119097) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Dec 22, 2023

The Miri subtree was changed

cc @rust-lang/miri

@nnethercote
Copy link
Contributor Author

Lots of commits, but they're mostly small and all self-contained.

Bug,

/// This is a strange one: lets you register an error without emitting it. If compilation ends
/// without any other errors occurring, this will be emitted as an error. Otherwise, it will be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be emitted as an error

It will be emitted as a bug, I though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some unclear terminology. Sometimes "error" means Level::Error and sometimes it means Level::{BugDelayed,Fatal,Error,FailureNote}, e.g. here.

But even with that in mind, this is a clumsy sentence, I'll fix it up in a minute.

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 22, 2023

📌 Commit 4bea661 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 22, 2023
@nnethercote
Copy link
Contributor Author

I fixed the comment.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Dec 22, 2023

📌 Commit fbfe0e7 has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Dec 22, 2023

☔ The latest upstream changes (presumably #118824) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 22, 2023
There is room for improvement on some of these, but something is better
than nothing.
We can just get the error level in the `match` and then use
`DiagnosticBuilder::new`. This then means a number of `DiagCtxt`
functions are no longer needed, because this was the one place that used
them.

Note: the commit changes the treatment of spans for `Expect`, which was
different to all the other cases, but this has no apparent effect.
There are a bunch of them about 400 lines down, which is weird and
annoying. This commit moves them up and puts them in a more sensible
order.
`IntoDiagnostic` defaults to `G = ErrorGuaranteed`. Take advantage of
this in one place that currently doesn't.
Its single use can be replaced with `Diagnostic::new_with_messages`.
Lots of vectors of messages called `message` or `msg`. This commit
pluralizes them.

Note that `emit_message_default` and `emit_messages_default` both
already existed, and both process a vector, so I renamed the former
`emit_messages_default_inner` because it's called by the latter.
It's only ever set to `None`.
It has three variants, but only `LabelKind::Label` is ever used. This
means `SingleLabelManySpans::kind` can also be removed.
Some of the `Level::` qualifiers in this file are omitted. This commit
removes the remainder.
There are quite a few hand-written `IntoDiagnostic` impls.
There are only three. It's simpler to make the type
`DiagnosticBuilder<'_, ()>` from the start, no matter the level, than to
change the guarantee later.
It's unused. And this means `DiagnosticBuilderInner` no longer needs to
be separate from `DiagnosticBuilder`.
@nnethercote
Copy link
Contributor Author

I fixed the conflicts.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Dec 23, 2023

📌 Commit 2cd14bc has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 23, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
…mpiler-errors

Rollup of 6 pull requests

Successful merges:

 - rust-lang#119012 (Extract `layout_of_{struct,enum}` fn)
 - rust-lang#119077 (Separate MIR lints from validation)
 - rust-lang#119171 (Cleanup error handlers: round 4)
 - rust-lang#119198 (Split coroutine desugaring kind from source)
 - rust-lang#119222 (Add `IntoAsyncIterator`)
 - rust-lang#119230 (Exhaustiveness: clean up after librarification)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e0d7a72 into rust-lang:master Dec 23, 2023
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Dec 23, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2023
Rollup merge of rust-lang#119171 - nnethercote:cleanup-errors-4, r=compiler-errors

Cleanup error handlers: round 4

More `rustc_errors` cleanups. A sequel to rust-lang#118933.

r? `@compiler-errors`
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Dec 24, 2023
…mpiler-errors

Cleanup error handlers: round 4

More `rustc_errors` cleanups. A sequel to rust-lang#118933.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 5, 2024
…mpiler-errors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang#119171.

r? `@compiler-errors`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 5, 2024
…mpiler-errors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang#119171.

r? ``@compiler-errors``
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 5, 2024
…mpiler-errors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang#119171.

r? ```@compiler-errors```
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jan 5, 2024
…mpiler-errors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang#119171.

r? ````@compiler-errors````
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 5, 2024
Rollup merge of rust-lang#119538 - nnethercote:cleanup-errors-5, r=compiler-errors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang#119171.

r? ````@compiler-errors````
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jan 6, 2024
…rors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang/rust#119171.

r? ````@compiler-errors````
GuillaumeGomez pushed a commit to GuillaumeGomez/rustc_codegen_gcc that referenced this pull request Feb 15, 2024
…rors

Cleanup error handlers: round 5

More rustc_errors cleanups. A sequel to rust-lang/rust#119171.

r? ````@compiler-errors````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants